﻿/*
 * Erstellt mit SharpDevelop.
 * Benutzer: Kai Patrick
 * Datum: 20.03.2008
 * Zeit: 18:31
 * 
 * Sie können diese Vorlage unter Extras > Optionen > Codeerstellung > Standardheader ändern.
 */
using System;
using System.IO;
using System.Windows.Forms;

namespace Gamadus.Builder
{
	class Program
	{
		public static void Main(string[] args)
		{
			
			//TODO: GML is case sensitive! check this implementation.
//			if(args.Length < 2)
//            {
//            	Console.WriteLine("Syntax: Builder input.gpf output.exe");
//            	return;
//            }
			
			
			Console.WriteLine("Welcome to Gamadus C# Builder...");
			if(!Build("game.gpf", "game.exe"))
				Console.WriteLine("There was an error while building the game");
			Console.Write("Press any key to continue . . . ");
			Console.ReadKey(true);
		}
		
		public static bool Build(string fileIn, string fileOut)
		{
			DirectoryMgr.Instance.Init();
			EngineMgr.Instance.Init(DirectoryMgr.Instance.RunDir+"Gamadus.Engine.dll");
			
			if(!ResourceMgr.Instance.Load(fileIn))
				return false;
			//TODO: write gpf project to engine sources
			Generator.Generate("show_message(String(fps+5*x))");
			
			//Compiler.Instance.Compile(fileOut);
			
			DirectoryMgr.Instance.Clean();
			return true;
		}
	}
}